package com.example.demo.contoller;

import com.example.demo.entity.DataRule;
import com.example.demo.service.DataRuleService;
import com.example.demo.util.NetworkUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

@RestController
@RequestMapping("/dataRule")
public class DataRuleController {
	@Autowired
	private DataRuleService dataRuleService;
	@GetMapping
	public DataRule getDataRule(@RequestParam("ruleNo")String ruleNo, HttpServletRequest request) {
		System.out.println(NetworkUtil.getIpAddress(request));
		return dataRuleService.get(ruleNo);
	}
}
